package com.weishe.loc;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class LocGroup extends WritableComparator {

	// 按时间段分组
	public int compare(WritableComparable a, WritableComparable b) {
		Loc l1 = (Loc) a;
		Loc l2 = (Loc) b;

		int r = l1.getImei().compareTo(l2.getImei());
		if (r == 0) {
			r = l1.getLoc().compareTo(l2.getLoc());
			if (r == 0) {
				r = Long.compare(l1.getTime(), l2.getTime());
			}
		}
		return r;
	}

}
